@extends('admin.layout.layout', ['row' => @$page])

@section('contain')
    <style>
        .dhlx-box{
            /*width: 800px;*/
        }
        .dhlx-box .title{
            text-align: center;
        }
        .dhlx-box .title b{
            display: inline-block;
            background-color: #dcdfe6;
            font-weight: normal;
            font-size: 1.25rem;
            padding: .5rem 2rem;
            line-height: 1rem;
        }
        .dhlx-box .dhlx-body{
            display: flex;
            flex-wrap: nowrap;
            border: 1px solid #ebeef5;
        }
        .dhlx-box .dhlx-body .ygms{
            flex: 0 0 50%;
            padding: 25px;
            box-sizing: border-box;
            border-right: 1px solid #ebeef5;
        }
        .dhlx-box .dhlx-body .xgms{
            flex: 0 0 50%;
            padding: 25px;
            box-sizing: border-box;
            border-left: 1px solid #ebeef5;
        }
        .table .tth{
            background-color: rgba(0, 0, 0, 0.05);
            width: 150px;
            font-weight: bold;
        }
        .table .ttd{
            width: 350px;
        }
        .table .tst{
            color: #1e89e0;
            font-weight: 700;
            text-align: center;
            font-size: 1.25rem;
        }
    </style>

    <div class="portlet">
        <div class="portlet-title">
            <div class="caption">
                <x-portlet-breadcrumb :page="$page"></x-portlet-breadcrumb>
            </div>
            <div class="actions"></div>
        </div>

        <div class="my-3 bg-light p-3 px-4">
            <div class="row">
                <div class="col-auto">
                    <b>{{ ts('rollnumber') }}</b>：
                    <span>{{ @$data->roll_number }}</span>
                </div>
                <div class="col-auto">
                    <b>{{ ts('filmtype') }}</b>：
                    <span>{{ ts('film_type_master.'.@$data->film_type_id) }}</span>
                </div>
                <div class="col-auto">
                    <b>{{ ts('changdu') }}</b>：
                    <span>{{ @$data->length }} cm</span>
                </div>
                <div class="col-auto">
                    <b>{{ ts('createdat') }}</b>：
                    <span>{{ fdate(@$data->created_at) }}</span>
                </div>
            </div>
        </div>
        <table class="table table-s2">
            <tbody>
            <tr>
                <th>
                    {{ ts('rollnumber') }}
                </th>
                <td>
                    {{ @$data->roll_number }}
                </td>
            </tr>
            <tr>
                <th>
                    {{ ts('CHANGDU') }}
                </th>
                <td>
                    {{ @$data->length }} cm
                </td>
            </tr>
            <tr>
                <th>
                    {{ ts('ygmsmc') }}
                </th>
                <td>
                    {{ @$data->ygmsmc }}
                </td>
            </tr>
            <tr>
                <th>
                    {{ ts('fqr') }}
                </th>
                <td>
                    {{ @$data->fqr }}
                </td>
            </tr>
            <tr>
                <th>
                    {{ ts('fqsj') }}
                </th>
                <td>
                    {{ fdate(@$data->created_at) }}
                </td>
            </tr>

            <tr>
                <th>
                    {{ ts('dqzt') }}
                </th>
                <td>
                    {{ ts('STA'.@$data->status) }}
                </td>
            </tr>
            @empty(@$data->status)
            @else
                <tr>
                    <th>
                        {{ ts('CZY') }}
                    </th>
                    <td>
                        {{ @$data->czr }}
                    </td>
                </tr>

                <tr>
                    <th>
                        {{ ts('CZSJ') }}
                    </th>
                    <td>
                        {{ fdate(@$data->updated_at) }}
                    </td>
                </tr>

                <tr>
                    <th>
                        {{ ts('explain') }}
                    </th>
                    <td>
                        {{ @$data->note }}
                    </td>
                </tr>
            @endif
            </tbody>
        </table>
        @if(@$data->status == 0)
            <div class="my-3">
                <button class="btn btn-primary mr-5" onclick="verifyReturn(1, '{{ @$data->note }}', '{{ @$data->ygmsmc }}')">{{ ts('TY') }}</button>
                <button class="btn btn-danger ml-5" onclick="verifyReturn(2, '{{ @$data->note }}', '{{ @$data->ygmsmc }}')">{{ ts('JJ') }}</button>
            </div>
        @else
            {{--<div class="my-3">
                {{ ts('status') }}：{{ ts('STA'.@$data->status) }}
            </div>--}}
        @endif
    </div>



@endsection

@section('script')
    <script>
        function verifyReturn(verify, text, abbr) {
            var url = '/{{ request()->path() }}/verify';
            var msg = '是否确认因为 ' + text + ' 原因';
            if (verify == 1) {
                msg += '同意'
            } else {
                msg += '拒绝'
            }
            msg += abbr + '退货？';
            mySwalV2({t: msg, c:'input'})
                .then(function (d) {
                    var msg = String(d).trim();
                    request.post(url, {
                        verify: verify,
                        note: d
                    })
                        .then(function (d) {
                            mySwal2(d.msg || '审核成功！')
                        })
                        .catch(function (d) {
                            sw3(d.msg || '系统错误，请稍后重试', 'error');
                        })
                })
                .catch(function (d) {
                    console.log(d)
                })
        }
    </script>
@endsection